import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home.vue';
import Login from '@/components/Login.vue';
import HomeUsers from '@/components/HomeUsers.vue';
import HomeMenus from '@/components/HomeMenus.vue';
import UserAdd from '@/components/UserAdd.vue';
import UserEdit from '@/components/UserEdit.vue';
import HomeOutlines from '@/components/HomeOutlines.vue';
import HomePapers from '@/components/HomePapers.vue';
import PaperAdd from '@/components/paperadd.vue';
import PaperEdit from '@/components/PaperEdit.vue';
import Publish from '@/components/Publish.vue';
import Analysis from '@/components/Analysis.vue';
import HomeItems from '@/components/HomeItems.vue';
import HomeClasses from '@/components/HomeClasses.vue';
import Personalcenter from '@/components/Personalcenter.vue';
import Regist from '@/components/Regist.vue';

Vue.use(Router)

export default new Router({
  routes: [
    {
      path:'/',
      redirect:{name:'users'}
    },
    {
      path: '/home',
      name: 'home',
      redirect:{name:'users'},      
      component: Home,
      children:[
        {
        path:'users',
        name:'users',
        component:HomeUsers
        },
        {
          path:'users/add',
          name:'userAdd',
          component:UserAdd
        },
        {
          path:'users/edit/:id',
          name:'userEdit',
          component:UserEdit,
          props:true
        },
        {
          path:'menus',
          name:'menus',
          component:HomeMenus
          },
          {
            path:'outlines',
            name:'outlines',
            component:HomeOutlines
          },
          {
            path:'/items',
            name:'items',
            component:HomeItems
          },
          {
            path:'papers',
            name:'papers',
            component:HomePapers
          },
          {
            path:'paperadd',
            name:'paperadd',
            component:PaperAdd
          },
          {
            path:'paperedit/:id',
            name:'paperedit',
            component:PaperEdit,
            props:true
          },
          {
            path:'analysis/:id',
            name:'analysis',
            component:Analysis,
            props:true
          },
          {
            path: '/classes',
            name: 'classes',
            component: HomeClasses
          },
          {
            path: '/resetpassword',
            name: 'Personalcenter',
            component: Personalcenter
          },
      ]
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/users/regist',
      name: 'regist',
      component: Regist
    },
    {
      path: '/publish/:id',
      name: 'publish',
      component: Publish,
      props:true
    },
  ]
})
